package com.woniuxy.mqconsumer.service;

import com.woniuxy.mqconsumer.entity.EsBook;
import com.woniuxy.mqconsumer.mapper.BookMapper;
import com.woniuxy.mqconsumer.repository.EsRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EsService {
    @Autowired
    EsRepository esRepository ;

    @Autowired
    BookMapper bookMapper ;

    public EsBook findEsBookByKey(Long bookId){
        return bookMapper.selectEsBookByKey(bookId);
    }

    //同步索引库
    public void saveEsBookToIndex(EsBook esBook){
        esRepository.save(esBook);
    }
}
